//
//  Extensive.swift
//  MGExtensionsKit
//
//

import Foundation

public struct Extensive<Base> {
    /// Base object to extend.
    public let base: Base

    /// Creates MGExtensionsKit with base object.
    ///
    /// - parameter base: Base object.
    public init(_ base: Base) {
        self.base = base
    }
}

/// A type that has extensive MGExtensionsKit.
public protocol ExtensiveCompatible {
    /// Extended type
    associatedtype ExtensiveBase

    /// Extensive MGExtensionsKit.
    static var mg: Extensive<ExtensiveBase>.Type { get }

    /// Extensive MGExtensionsKit.
    var mg: Extensive<ExtensiveBase> { get }
}

extension ExtensiveCompatible {
    
    public static var mg: Extensive<Self>.Type {
        return Extensive<Self>.self
    }

    /// Extensive MGExtensionsKit.
    public var mg: Extensive<Self> {
        return Extensive(self)
    }
}

extension String: ExtensiveCompatible { }
extension Double: ExtensiveCompatible { }
extension UIViewController: ExtensiveCompatible { }
extension UIImage: ExtensiveCompatible { }
extension UIButton: ExtensiveCompatible { }
extension FileManager: ExtensiveCompatible { }
extension NSPointerArray: ExtensiveCompatible { }
